package enums;

/**
 * 端类型枚举
 * Create on 2019-07-11 11:47
 *
 * @author tianbl
 */
public enum PlatformTypeEnum {
    /**
     * 终端类型判断
     */
    WECHAT(0, "微信"),
    WXAPPLET(1, "微信小程序"),
    APP(2, "App"),
    WEBBROWSER(3, "浏览器"),
    ALIPAY(4,"支付宝");

    private Integer code;
    private String name;

    PlatformTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static PlatformTypeEnum getEnum(Integer code) {
        PlatformTypeEnum result = null;
        for (PlatformTypeEnum typeEnum : PlatformTypeEnum.values()) {
            if (typeEnum.getCode().equals(code)) {
                result = typeEnum;
                break;
            }
        }
        return result;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
